$(document).ready(function () {
    apiAdminLogout();
    $("#btnLogin").click(function () {
        var account = $("#txtLoginName").val();
        var password = $("#txtLoginPass").val();
        if (account.length === 0 || password.length === 0) {
            Swal.fire('用户名密码不能为空')
            return;
        }
        apiAdminLogin(account, password, function (data) {
            localStorage.setItem('nickname', data.msg.userData.nickname);
            localStorage.setItem('permission', data.msg.userData.permission);
            if (data.msg.userData.permission == 4) {
                $(location).attr('href', '/webs/proxy/pages/userManager.html');
            } else {
                $(location).attr('href', '/webs/main.html');
            }

        })
    });
});